//
//  UseProNameTableViewCell.m
//  FaceTo
//
//  Created by 程邦明 on 2017/8/11.
//  Copyright © 2017年 chengbangming. All rights reserved.
//

#import "UseProNameTableViewCell.h"

@implementation UseProNameTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initUI];
    }
    return self;
}
- (void)initUI{
    _lineView = [[UIView alloc]init];
    _lineView.backgroundColor = Color(238, 238, 238);
    [self addSubview:_lineView];
    
    _proNameLabel = [[UILabel alloc]init];
    _proNameLabel.font = [UIFont systemFontOfSize:20];
    _proNameLabel.text = @"商品名称";
    _proNameLabel.textAlignment = NSTextAlignmentLeft;
    _proNameLabel.textColor = Color(51, 51, 51);
    [self addSubview:_proNameLabel];
    
    _priceLabel = [[UILabel alloc]init];
    _priceLabel.textAlignment = NSTextAlignmentRight;
    _priceLabel.text = @"500+20￥";
    _priceLabel.textColor = Color(251, 214, 70);
    _priceLabel.font = [UIFont systemFontOfSize:25];
    [self addSubview:_priceLabel];
    
    _shengyuLabel = [[UILabel alloc]init];
    _shengyuLabel.font = [UIFont systemFontOfSize:12];
    _shengyuLabel.text = @"剩余数量：10";
    _shengyuLabel.textAlignment = NSTextAlignmentLeft;
    _shengyuLabel.textColor = Color(112, 112, 112);
    [self addSubview:_shengyuLabel];

    _oldLabel = [[UILabel alloc]init];
    _oldLabel.textAlignment = NSTextAlignmentRight;
    _oldLabel.text = @"商品原价：25￥";
    _oldLabel.textColor = Color(112, 112, 112);
    _oldLabel.font = [UIFont systemFontOfSize:12];
    [self addSubview:_oldLabel];
    
    [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(0);
        make.right.offset(0);
        make.top.offset(0);
        make.height.mas_equalTo(5);
    }];
    
    [_proNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(30);
        make.top.equalTo(_lineView.mas_bottom).with.offset(22);
        make.height.mas_equalTo(22);
    }];
    
    [_shengyuLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_proNameLabel.mas_left);
        make.top.equalTo(_proNameLabel.mas_bottom).with.offset(10);
        make.height.mas_equalTo(14);
    }];
    
    [_priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.offset(-30);
        make.top.equalTo(_proNameLabel.mas_top);
        make.height.mas_equalTo(27);
    }];
    
    [_oldLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.offset(-30);
        make.centerY.equalTo(_shengyuLabel.mas_centerY);
        make.height.mas_equalTo(14);
    }];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
